﻿<?php
include_once("../function.php");
//print_r($_GET);die;//Array ([pingjia] [pinglun] [o_pid])
extract($_GET);//
$pingjia=trim($pingjia);
$pinglun=trim($pinglun);
$time=time();
$sql="select * from ts_order_goods where o_pid=$o_pid";
$res=mysqli_query($link,$sql);
$res1=mysqli_fetch_assoc($res);
$sql="insert into ts_message(msg_content,msg_star,user_id,o_pid,goods_id,msg_time) values('$pinglun','$pingjia','$_COOKIE[userid]','$o_pid','$res1[pid]','$time')";
$res=mysqli_query($link,$sql);
if($res)
{
	if(mysqli_affected_rows($link)==1)
		$msg_id=mysqli_insert_id($link);
		$sql="update ts_order_goods set msg_id=$msg_id where o_pid=$o_pid";
		mysqli_query($link,$sql);
	{
		$msg_id=mysqli_insert_id($link);
		msg("感谢您的评论","./xqy.php?pid=$res1[pid]");exit;
	}
}
?>